﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;

namespace BLL
{
    public class MembersBll
    {
        private const string Sold = "finaceKey";

        public Members CheckLogin(string memberName, string password)
        {
            password = FormsAuthentication.HashPasswordForStoringInConfigFile(password + Sold, "MD5"); 

            var result = (from a in DB.PersonalFinanceDB.Members
                                where a.MemberName == memberName && a.PassWord == password
                                select a);

             Members members = null;
             if (result.Count() > 0)
             {
                 members = result.Single<Members>();
             }

             return members;
        }
    }
}
